package com.shg.present.controller;

import com.shg.core.domain.User;
import com.shg.present.model.LearnResource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by roger on 2017/4/18.
 */
@Controller
public class LearnController {
    @RequestMapping("/learn")
    public ModelAndView index(){
        List<LearnResource> list = new ArrayList<LearnResource>();
        LearnResource resource = new LearnResource("test1", "test1's description", "www.testurl.com");
        list.add(resource);
        resource = new LearnResource("test2", "test2's description", "www.test2url.com");
        list.add(resource);
        ModelAndView mv = new ModelAndView("/learn");
        mv.addObject("learnList",list);
        return mv;
    }

    @RequestMapping("/learn/news")
    public ModelAndView news(){
        List<LearnResource> list = new ArrayList<LearnResource>();
        LearnResource resource = new LearnResource("test1", "test1's description", "www.testurl.com");
        list.add(resource);
        resource = new LearnResource("test2", "test2's description", "www.test2url.com");
        list.add(resource);
        ModelAndView mv = new ModelAndView("/board/news");
        mv.addObject("learnList",list);
        return mv;
    }




}
